Skip to content

Commit 2b79b27

Browse files
authored
Merge pull request #6623 from akatsoulas/invalidate-cache-on-archive-change
Invalidate cache on archival state change
2 parents 4d9e785 + 46bc6e5 commit 2b79b27

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kitsune/products/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def get_absolute_url(self, product_slug=None):
170170
return reverse(named_url, kwargs=kwargs)
171171

172172
def save(self, *args, **kwargs):
173-
if self._topic_is_archived != self.is_archived and self.is_archived:
173+
# Check if the is_archived field has changed
174+
if self._topic_is_archived != self.is_archived:
174175
for product in self.products.all():
175176
cache_key = f"hierarchical_topics_{product.slug}"
176177
cache.delete(cache_key)

0 commit comments

Comments
 (0)